---
title: "READ-ME Courting Civilians During Conflict: Evidence from Taliban Judges in Afghanistan"
author: "Donald Grasse, Renard Sexton, Austin Wright"
date: "2023-11-09"
output: pdf_document
---
  
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Replication Instructions 

This is the read me file for replication of the manuscript ``Courting the Civilians during Conflict: Evidence from Taliban Judges in Afghanistan.'' 

### Data in Data Folder 
The replication package includes the following datasets and scripts to produce results.  

Dataframes for analysis: 
\begin{itemize}
\item `full\_panel\_df.rds' (main panel dataset of district years), variable descriptions in the paper 
\item `qsi\_publicuse\_2020v1.csv' (cross-national dataset of rebel governance for map)
\item `pop\_interpolation.rds' (interpolated population data for Afghan districts)
\item `courts\_treatment.dta' (districts with Taliban courts and the year they appeared)
\item `anqar\_panel\_2023.rds' (aggregated to district year survey data)
\item `balance\_panel\_df.rds' (panel dataset for balance tests)
\item `enumerability\\ \_DISTID\_cross\_section.dta' (enumeration access in 2010 across districts)
\item `AFG\\ \_district\_398\_district398.shp' (shapefile of Afghan disticts)
\item `anqar\_indv.rds' (aggregated to demographic-year-district)
\item `anqar\_indv\_ses.rds' (aggregated to SES-year-district)
\end{itemize}

Due to restrictions in our data sharing agreement, Table 5, Table A07, and Table A08 cannot be reproduced. We include the code for users that can obtain data access. Dataframes that cannot be included in the replication files but are required to reproduce the main results include: 
\begin{itemize}
\item `ANQAR\_ALL.dta' (respondent-level). 
\end{itemize}
\noindent these datasets are sensitive and our permission to access them restricts our ability to share them for public use. This table has been moved to the folder not\_run. 

## Analysis 

The file \_+central.R will load all necessary packages, extra functions, and data to produce all figures and tables that appear in the main text and appendix. A scholar interested in reproducing just one figure or table can do so using the argument source(.) where . refers to the name of the script that the scholar seeks to recreate. Note that some tables are edited in .tex for aesthetics, and thus the output does not exactly match what appears in the final .PDFs, where additional labels and notes are added manually to improve transparency and readability.

A researcher wishing to reproduce an individual table or figure can do so by looking inside of the tabs-in or figs-in folder. Each table and figure is named as it appears in the manuscript - for instance, code to produce Table 2 in the main text is in tab2-baseline-in.R and Figure A1 is in figA1-balance-in.R. 

The file `_pgks.R' includes all packages necessary for the analysis. Again, if a researcher wishes to produce just an individual table or figure, they will want to consult the _pgks.R.R script to load everything that is necessary.

The file _funs.R includes functions created by the author to conduct the analysis. 

As always, take care to set the working directory! Each individual script assumes you have loaded the packages and set the working directory as set in the _+central.R script. So make sure you check that first even if you just want to look at one particular table/figure. 

Also note that some Figure 1 and Figure 4 are drawn in LaTex, so there are no replication files for those Figures. 

## Technical Information  

```{r, echo = F, results='asis'}
m <- sessionInfo()
```
R version 4.2.1 (2023-11-09) \\\\
Platform: x86_64-apple-darwin17.0 (64-bit) \\\\
Running under: macOS Monterey 12.3.1

Please note that the standard error estimation is computationally intensive/expensive because we characterize uncertainty through resampling after applying PCA. 

## Questions?
Questions? Please contact Donald (Don, Donnie) Grasse \<donald dot grasse dot 93 at gmail dot com\>. 




